package com.yangyang.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yangyang.entity.Account;
import com.yangyang.entity.Finance;
import com.yangyang.entity.QueryVo;
import com.yangyang.service.FinService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yangyang.dao.FinDao;

@Service
public class FinServiceImpl implements FinService {

    @Autowired
    FinDao dao;

    /**
     * 查询
     * @param vo
     * @param pageNum
     * @param pageSize
     * @return
     */
    @Override
    public PageInfo<Finance> list(QueryVo vo, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        PageInfo<Finance> financePageInfo = new PageInfo<Finance>(dao.list(vo));
        return financePageInfo;
    }

    /**
     * 根据名字获取id
     * @param name
     * @return
     */
    @Override
    public Account getAccountByName(String name) {
        return dao.getAccountByName(name);
    }

    /**
     * 添加
     * @param finance
     * @return
     */
    @Override
    public int add(Finance finance) {
        return dao.add(finance);
    }
}
